package au.org.ala.collectors

class CollectorsTagLib {

    static namespace = 'ci'

    /**
     * Creates a link to show the records with names that start with the letters specified.
     *
     * @attrs start - one or more letters
     */
    def alphaLink = { attrs ->
        def letters = attrs.starts
        if (letters) {
            def upper = letters.toUpperCase()
            def text = upper.collect{it}.join('-')
            out << link(controller: 'person', action:'alphaList', params:[starts:"${upper}"]) {text}
        } else {
            out << link(controller: 'person', action:'alphaList') {text}
        }
    }
}
